// 商品分类controller
"use strict";
const { Controller } = require("egg");

class cClasses extends Controller {
  // pc
  async pc_c_queryAll() {
    const { ctx } = this;
    const result = await ctx.service.sClasses.pc_s_queryAll(ctx?.query ?? {});
    ctx.body = result;
  }
  async pc_c_queryClassAll() {
    const { ctx } = this;
    const result = await ctx.service.sClasses.pc_s_queryClassAll(ctx?.query ?? {});
    ctx.body = result;
  }
  // Web端查询分类
  async pc_c_query() {
    const { ctx } = this;
    const result = await ctx.service.sClasses.pc_s_query(ctx?.query ?? {});
    ctx.body = result;
  }


  // 增加分类 - 后台管理
  async pc_c_create() {
    const { ctx } = this;
    const result = await ctx.service.sClasses.pc_s_create(
      ctx?.request?.body ?? {}
    );
    ctx.body = result;
  }

  // 更新分类 - 后台管理
  async pc_c_update() {
    console.log("?? - pc_c_update");
    const { ctx } = this;
    const result = await ctx.service.sClasses.pc_s_update(
      ctx?.request?.body ?? {}
    );
    ctx.body = result;
  }
  // 删除分类 - 后台管理
  async pc_c_delete() {
    console.log("?? - pc_c_delete");
    const { ctx } = this;
    const result = await ctx.service.sClasses.pc_s_delete(ctx?.query ?? {});
    ctx.body = result;
  }

  // 查询所有商品分类【不分页】
  async pc_c_query_all() {
    const { ctx } = this;
    const result = await ctx.service.sClasses.pc_s_query_all(ctx?.query ?? {});
    ctx.body = result;
  }

  // Do not edit
  async wa_c_query() {
    const { ctx } = this;
    const result = await ctx.service.sClasses.wa_s_query(ctx?.query ?? {});
    ctx.body = result;
  }
  //依据二级分类查询商品
  async wa_c_second_class_goods() {
    const { ctx } = this;
    const result = await ctx.service.sClasses.wa_s_second_class_goods(ctx?.query ?? {});
    ctx.body = result;
  }




}

module.exports = cClasses;
